{template 'common/header'}
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/css/style.css" />
<link rel="stylesheet" type="text/css" href="../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.css" />
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">
            文章>编辑
        </h3>
    </div>
    <div class="panel-body">
        <form id="sign-form" class="form-horizontal" role="form" method="post" action="{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'savemodel','version_id'=>$_GPC['version_id'])}" name="submit" style="padding: 20px 0;">
            <div class="form-group">
                <label for="title" class="col-sm-2 control-label">标题</label>
                <div class="col-sm-8">
                    <input type="text" class="form-control"  name="title" id="title" value="{$list['title']}">
                    <input type="hidden" name="id" value="{$list['id']}">
                </div>
            </div>
            <!--<div class="form-group">-->
                <!--<label class="col-sm-2 control-label">类型</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<select class="selectpicker show-tick form-control bs-select-hidden" data-live-search="true" name="type" style="width: 50%;">-->
                        <!--<option value="0" hassubinfo="true">请选择分类</option>-->
                        <!--<option value="1" {if $list['type']==1}selected{/if}>普通文章</option>-->
                        <!--<option value="2" {if $list['type']==2}selected{/if}>优惠活动文章</option>-->
                    <!--</select>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-2 control-label">链接</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<div class="input-group ">-->
                        <!--<input type="text" class="form-control"  name="link" value="{$list['link']}">-->
                        <!--<span class="input-group-btn">-->
                            <!--<button class="btn btn-default link" type="button" data-toggle="modal" data-target="#sort_link">选择商品</button>-->
                        <!--</span>-->
                    <!--</div>-->
                <!--</div>-->
            <!--</div>-->
            <!--<div class="form-group">-->
                <!--<label class="col-sm-2 control-label">自定义链接按钮文字</label>-->
                <!--<div class="col-sm-8">-->
                    <!--<input type="text" class="form-control"  name="btn" id="btn" value="{$list['btn']}">-->
                <!--</div>-->
            <!--</div>-->
            <div class="form-group">
                <label  class="col-sm-2 control-label">模式</label>
                <div class="col-sm-8">
                    <label class="radio inline" style="width: 60px;">
                        <input type="radio" class="ui-radio" name="link_type" id="link_type1" value="1" {if $list['link_type']==1}checked{/if}>H5模式
                    </label>
                    <label class="radio inline" style="width: 80px;">
                        <input type="radio" class="ui-radio" name="link_type" id="link_type2" value="2" {if $list['link_type']==2}checked{/if}>小程序模式
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">内容</label>
                <div class="col-sm-10">
                    {php echo tpl_ueditor('content',$list['content']);}
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <input type="button" name="submit" class="btn btn-default" value="提交">
                    <a class="btn btn-default" href="{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'])}">返回</a>
                    <input id="res" name="res" type="reset" style="display:none;" />
                </div>
            </div>
        </form>
    </div>
</div>
<!--首页排版链接选择-->
<div class="modal fade" id="sort_link"><div class="modal-dialog">
    <style>
        #sort_link .modal-body {padding: 10px 15px;}
        #sort_link .tab-pane {margin-top: 5px; min-height: 400px; max-height: 400px; overflow-y: auto;}
        #sort_tab{margin-bottom: 10px;}
    </style>
    <div class="modal-content">
        <div class="modal-header">
            <button data-dismiss="modal" class="close" type="button">×</button>
            <h4 class="modal-title">链接</h4>
        </div>
        <div class="modal-body">
            <div class="tab-content ">
                <div class="tab-pane active" id="sort_service">
                    <iframe width="100%" height="395" frameborder="no" border="0" scrolling="no" allowtransparency="yes" src="{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'sort_service')}"></iframe>
                </div>
            </div>
        </div>
        <div class="modal-footer">
            <button data-dismiss="modal" class="btn btn-default" id="sort_close" type="button">关闭</button>
        </div>
    </div>
</div></div>
<!--首页排版链接选择 end-->
<script>
    var objc="";
    require(["../addons/{php echo $_GPC['m']}/resource/swal/dist/sweetalert2.min.js"],function(){
        $(function(){
            $(".link").click(function(){
                objc=$(this);
            });
            $("input[name='submit']").click(function(){
                var data=$(".form-horizontal").serialize();
                $.ajax({
                    type:"post",
                    url:"{url 'site/entry/'.$_GPC['do'],array('m'=>$_GPC['m'],'op'=>'savemodel','version_id'=>$_GPC['version_id'])}",
                    data:data,
                    dataType:'json',
                    success:function(res){
                        if(res.status==1){
                            if($("input[name='id']").val()==""){
                                $("input[name='res']").click();
                                $("body").find(".img-responsive.img-thumbnail").attr("src","");
                            }
                            swal('操作成功!', '操作成功!', 'success');
                        }else{
                            swal('操作失败!', '操作失败!', 'error');
                        }
                    }
                })
            });
        })
    })
</script>
{template 'common/footer'}